abstract class Animal//创建一个抽象类
{
    public void fun()
    {
        System.out.println("这时一个普通的fun函数!");
    }
    //抽象方法不能被private或final或static修饰
    //抽象方法没被访问修饰符修饰就默认是public型

    public abstract void eat();
    abstract void sleep();

}
class Dog extends Animal
{
    public void eat()
    {
        System.out.println("小狗吃饭!");
    }
    public void sleep()
    {
        System.out.println("小狗睡觉!");
    }
}
class Cat extends Animal{
    @Override
    public void eat() {
        System.out.println("小猫吃饭!");
    }
    @Override
    public void sleep()
    {
        System.out.println("小猫睡觉!");
    }
}

public class Abstract {
    public static void main(String[] args) {
        Cat cat = new Cat();
        cat.eat();
        cat.sleep();
        Dog dog = new Dog();
        dog.eat();
        dog.sleep();
    }
}
